import request from '@/utils/request'

//获取用户列表信息的接口
export const getUserList = (page, limit, searchParams) => {
  return request.get(`/admin/acl/user/${page}/${limit}`, {
    params: searchParams
  })
};
//添加或更新用户的接口
export const addOrUpdateUser = (user) => {
  if (user.id) {
    return request.put('/admin/acl/user/update', user);
  }
  return request.post('/admin/acl/user/save', user);
};
//删除用户的接口
export const removeUser = (id) => {
  return request.delete(`/admin/acl/user/remove/${id}`);
};
//获取用户角色数据的接口
export const getUserPersonList = (userId) => {
  return request.get(`/admin/acl/user/toAssign/${userId}`);
};
//用户添加角色的接口
export const addUserPerson = (userId, roleId) => {
  return request.post('/admin/acl/user/doAssign', null, {
    params: {userId,roleId}
  });
};
//批量删除用户的接口
export const removeUserArr = (data) => {
  return request({
    url: `/admin/acl/user/batchRemove/`,
    data,
    method: 'post'
  });
};